package com.bottomlord.projects.user.web.controller;

import com.bottomlord.web.mvc.controller.PageController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Path;

@Path("/gitee")
public class LoginGiteeController implements PageController {
    public static final String CLIENT_ID = "b35b21fe48cdb2c45c2da65f7e397e80f8c41b269c57d02bc6b4b9011ca85a80";
    public static final String CLIENT_SECRET = "2205b479fd201d801454f9f8909821a4c360060ce6f9eab111c9f4b97c4207b8";
    public static final String REDIRECT_URL = "http://localhost:8080/login";

    @Override
    public String execute(HttpServletRequest request, HttpServletResponse response) throws Throwable {
        response.sendRedirect("https://gitee.com/oauth/authorize?client_id=" + CLIENT_ID + "&redirect_uri=" + REDIRECT_URL + "&response_type=code");
        return null;
    }
}
